#include "widget.h"
#include "ui_widget.h"
#include <QShortcut>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->horizontalSlider->setMinimum(100);
    ui->horizontalSlider->setMaximum(1000);
    ui->horizontalSlider->setSingleStep(100);
    ui->horizontalSlider->setValue(200);

    ui->verticalSlider->setMinimum(100);
    ui->verticalSlider->setMaximum(1000);
    ui->verticalSlider->setSingleStep(100);
    ui->verticalSlider->setValue(200);

    ui->verticalSlider->setInvertedAppearance(true);


    QShortcut* shortcutup = new QShortcut(this);
    QShortcut* shortcutdown = new QShortcut(this);
    QShortcut* shortcutleft = new QShortcut(this);
    QShortcut* shortcutright = new QShortcut(this);

    shortcutup->setKey(QKeySequence(Qt::Key_Up));
    shortcutdown->setKey(QKeySequence(Qt::Key_Down));
    shortcutleft->setKey(QKeySequence(Qt::Key_Left));
    shortcutright->setKey(QKeySequence(Qt::Key_Right));



}

Widget::~Widget()
{
    delete ui;
}

void Widget::up()
{
    QRect rect = ui->pushButton->geometry();
    ui->pushButton->setGeometry(rect.x(),rect.y(),rect.width(),rect.height());
}

void Widget::down()
{
    QRect rect = ui->pushButton->geometry();
    ui->pushButton->setGeometry(rect.x(),rect.y() + 10,rect.width(),rect.height());
}

void Widget::left()
{
    QRect rect = ui->pushButton->geometry();
    ui->pushButton->setGeometry(rect.x(),rect.y(),rect.width(),rect.height());
}

void Widget::right()
{
    QRect rect = ui->pushButton->geometry();
    ui->pushButton->setGeometry(rect.x(),rect.y() - 10,rect.width(),rect.height());
}
